<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <script src="js/axios.js"></script>
    <script src="js/vue.js"></script>
</head>
<body>
    <div id="app">
        <input  placeholder="请输入用户名" v-model="name">
        <input type="password" placeholder="密码" v-model="pass">
        <button type="button" @click="login()">登录</button>
    </div>
    <script>
        new Vue({
            el: '#app',
            data: {
                name: '',
                pass: ''
            },
            methods:{
                login() {
                    axios.get(
                        '/user/login',{params:{name:this.name,pass:this.pass}}
                    ).then(result=>{
                            if (result.data.success) {
                                location.href='emp.html'
                            } else {
                                alert("登录失败！");
                            }
                        }
                    );
                }
            }
        });
    </script>
</body>
</html>